<template>
  <p-no-found>
    <p-to-home
      class="trans"
      @click="go"
    >
      在返回首页看看吧
    </p-to-home>
  </p-no-found>
</template>

<script lang="ts">
import { defineComponent, onMounted } from 'vue'
export default defineComponent({
  name: 'NotFound',
  setup () {
    // 页面加载时
    onMounted(() => {
      document.title = 'Ceart博客·找不到啊'
    })

    const go = async () => {
      window.location.href = '/'
    }

    return { go }
  }
})
</script>

<style lang="sass" scoped>
p-no-found
  @apply fixed left-0 right-0 top-0 bottom-0 z-10 bg-white
  background: url(../../assets/images/404.jpg) no-repeat top/cover

  p-to-home
    @apply fixed left-1/2 bottom-1/4 -translate-x-1/2 font-bold text-sm px-12 py-6
    background: var(--btnBg)
    color: var(--btnColor)
    cursor: var(--cursorHover)

    &:before
      @apply absolute left-0 right-0 top-0 bottom-0
      z-index: -1
      content: ''
      background: var(--colorMain)
      transition: transform .5s ease-out
      transform: scaleX(0)
      transform-origin: 0 50%

    &:hover:before
      transition-timing-function: cubic-bezier(.45,1.64,.47,.66)
      transform: scaleX(1)
      background: var(--colorMain)
</style>
